<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./vue.js"></script>
  <script src="./vue-router.js"></script>
</head>
<body>
  <div id="app">
      <h1>我是根组件</h1>

      <router-link to='/books'>books</router-link>
      <router-link to='/news'>news</router-link>

      <hr>

      <a href="#/books">books</a>
      <a href="#/news">news</a>

      <hr>

      <router-view></router-view>
  </div>
  
  <script>
      const Books = {
          template:'<h1>books组件</h1>'
      }

      const News = {
          template:'<h1>news组件</h1>'
      }

      let myRouter = new VueRouter({
        routes:[{path:'/books',component:Books},{path:'/news',component:News}]
      })

    var vm = new Vue({
      el:'#app',
      router: myRouter
     });
  </script>
</body>
</html>
